#include "media/mediaengine.h"

namespace cricket {
	const int MediaEngineInterface::kDefaultAudioDelayOffset = 0;
}

#if !defined(DISABLE_MEDIA_ENGINE_FACTORY)

#if defined(HAVE_LINPHONE)
#include "talk/media/other/linphonemediaengine.h"
#endif  // HAVE_LINPHONE
#if defined(HAVE_WEBRTC_VOICE)
#include "talk/media/webrtc/webrtcvoiceengine.h"
#endif  // HAVE_WEBRTC_VOICE
#if defined(HAVE_WEBRTC_VIDEO)
#include "talk/media/webrtc/webrtcvideoengine.h"
#endif  // HAVE_WEBRTC_VIDEO

namespace cricket {
#if defined(HAVE_WEBRTC_VOICE)
#define AUDIO_ENG_NAME WebRtcVoiceEngine
#else
#define AUDIO_ENG_NAME NullVoiceEngine
#endif

#if defined(HAVE_WEBRTC_VIDEO)
	template<>
	CompositeMediaEngine<WebRtcVoiceEngine, WebRtcVideoEngine>::
		CompositeMediaEngine() {
			video_.SetVoiceEngine(&voice_);
	}
#define VIDEO_ENG_NAME WebRtcVideoEngine
#endif

	MediaEngineInterface* MediaEngineFactory::Create() {
#if defined(HAVE_LINPHONE)
		return new LinphoneMediaEngine("", "");
#elif defined(AUDIO_ENG_NAME) && defined(VIDEO_ENG_NAME)
		return new CompositeMediaEngine<AUDIO_ENG_NAME, VIDEO_ENG_NAME>();
#else
		return new NullMediaEngine();
#endif
	}

};  // namespace cricket

#endif  // DISABLE_MEDIA_ENGINE_FACTORY
